#

| Chapter 38 |

# 38. Starting, Stopping, and Killing Processes

Contents:
What's in This Chapter
fork and exec
Managing Processes: Overall Concepts
Subshells
The ps Command
The Controlling Terminal
Why ps Prints Some Commands in Parentheses
What Are Signals?
Killing Foreground Jobs
Destroying Processes with kill
Printer Queue Watcher: A Restartable Daemon Shell Script
Killing All Your Processes
Interactively Kill Processes Matching a Pattern
Processes Out of Control? Just STOP Them
Cleaning Up an Unkillable Process
Why You Can't Kill a Zombie
Automatically Kill Background Processes on Logout in csh
nohup

## 38.1 What's in This Chapter

We've already talked about so many of the topics in this chapter, here or there, that it may seem like a real hodgepodge. It's a grab-bag of important things to know about processes - which you can think of as programs that are actually running, rather than sitting on the disk somewhere.

The chapter starts out with a couple of conceptual articles. They define some important terms that you're likely to encounter in this chapter.

Then we talk about the ps command, which tells you what processes you have running and just what they are up to (articles 38.5, 38.6, 38.7).

The next few articles cover signals, which are one way processes communicate with one another. We cover topics like:

- What are signals (article 38.8)?

- How to send signals from the keyboard (articles 38.9 and 38.10; also see article 5.9).

- How shell programs can "handle" signals (article 38.11; also see article 44.12).

We go from there to a more general discussion of ways to kill processes:

- How to kill all your processes (article 38.12).

- How to kill processes by name rather than by process ID (article 38.13).

- How to stop runaway jobs (article 38.14).

- Why some processes don't seem to go away when you kill them (articles 38.15, 38.16).

- How to make sure all your processes die when you log out (article 38.17).

- How to make sure processes don't die when you log out (article 38.18).

- TOR

VI. Managing Processes |  | 38.2 fork and exec